"""
依赖注入配置
"""
from repositories.item_repository import ItemRepository
from services.item_service import ItemService

# 全局仓库实例 (单例模式，确保数据一致性)
_item_repository_instance = None

def get_item_repository() -> ItemRepository:
    """获取商品仓库实例 (单例)"""
    global _item_repository_instance
    if _item_repository_instance is None:
        _item_repository_instance = ItemRepository()
    return _item_repository_instance

def get_item_service() -> ItemService:
    """获取商品服务实例"""
    repository = get_item_repository()
    return ItemService(repository) 
 